package Main;

/**
 *
 * @author Wilco
 */
public class paddle extends GameObjects{
    
    double velocityMax;
    int score;
    int ammo;
    
    public paddle(double x, double vmax)
       {
           super(0, x, 0.5, 0, 0, 0.22);
           velocityMax = vmax;
           score = Game_Graphics.INIT_SCORE;
           ammo = 0;
       }
    
    public void setVelocityMax(double newV)     { this.velocityMax = newV;}
    public double getVelocityMax()     { return this.velocityMax;}
    
    public void incAmmo(){this.ammo += 3;}
    public void decAmmo(){this.ammo--;}
    public int getAmmo(){return this.ammo;}
    

    public boolean isHit (double objectY, double objectSize, int objectType)
    {
        if(objectY + objectSize > this.Y && objectY < this.Y + this.size){
            
            switch(objectType)
            {
                case 1:
                    this.decScore();
                    break;
                case 2:
                    this.setSize(0.8*this.getSize());
                    break;
                case 3:
                    if(this.getColour() == 0)
                        this.setColour(0xD0D0D0);
                    else
                        this.setColour(0);
                    break;
                case 4:
                    this.setVelocityMax(this.getVelocityMax()*-1);
                    break;
                case 5:
                    this.setSize(1.15*this.getSize());
                    break;
                case 6:
                    this.incScore();
                    break;
                case 7:
                    this.incAmmo();
                    break;
            }
            
            return true;
        }
        else
            return false;
    }
    
    //<editor-fold defaultstate="collapsed" desc="Score functions">
    public void incScore() { this.score++; }
    public void decScore() { 
        if(this.score - 1 == 0)
        {
            this.score--;
            Game_Graphics.eog = 1;
        }
        else
            this.score--; 
    }
    public int getScore() { return this.score; }
    public void setScore(int newscore) { this.score = newscore; }
    //</editor-fold>
}
